/**
 * 插件地址：https://github.com/skyvow/wx-extend
 * 验证插件: https://github.com/skyvow/wx-extend/blob/master/docs/components/validate.md
 * 教程：https://www.cnblogs.com/cisum/p/9556736.html
 */
import WxValidate from "../../plugs/wx-validate/WxValidate.js";

module.exports.createInstance = function () {
  const rules = {
    username: {
      required: true
    },
    phone: {
      required: true,
      tel: true
    },
    detailAddress: {
      required: true
    },
    townId: {
      required: true
    }
  };
  // 验证字段的提示信息，若不传则调用默认的信息
  const messages = {
    username: {
      required: '收货人不能为空'
    },
    phone: {
      required: '手机号码不能为空',
      tel: '请输入正确的手机号'
    },
    townId: {
      required: "所在区域不能为空"
    },
    detailAddress: {
      required: '详细地址不能为空',
    }
  };
  //
  return new WxValidate(rules, messages)
};
